package com.lupan.dataanalyze.controller;

import com.lupan.dataanalyze.domain.*;
import com.lupan.dataanalyze.domain.base.BaseParam;
import com.lupan.dataanalyze.domain.base.CycleType;
import com.lupan.dataanalyze.service.VehReportService;
import com.timanetworks.foundation.common.entity.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 说明：车辆运营网站报表统计
 *
 * @author lupan
 * @version 2017/6/23 14:13
 */

@Api(value = "REPORT", tags = "REPORT_APIs", description = "车辆运营网站报表统计")
@RestController
@RequestMapping({"report/admin"})
@Validated
public class VehReportController {

    @Autowired
    private VehReportService vehReportService;

    @ApiOperation(value = "获取通话时长", notes = "获取调用联通接口的总的通话时长，单位m。")
    @RequestMapping(value = "getAllCallLength",method = RequestMethod.GET)
    public Response getAllCallLength() {
        Long callLength = vehReportService.getAllCallLength();
        return Response.create(callLength);
    }

    @ApiOperation(value = "油耗-里程分布统计", notes = "获取油耗-里程分布统计。")
    @RequestMapping(value="oilMileageReport",method = RequestMethod.GET)
    public Response oilMileageReport(BaseParam param) {
        List<OilMileageVo> result = vehReportService.oilMileageReport(param);
        return Response.create(result);
    }

    @ApiOperation(value = "油耗-EMS版本分布 ", notes = "获取油耗-EMS版本分布统计数据。")
    @RequestMapping(value="oilEmsVersionReport",method = RequestMethod.GET)
    public Response oilEmsVersionReport(BaseParam param) {
        List<OilEmsVersionVo> result = vehReportService.oilEmsVersionReport(param);
        return Response.create(result);
    }

    @ApiOperation(value = "油耗-TCM版本分布 ", notes = "获取油耗-TCM版本分布统计数据。")
    @RequestMapping(value="oilTcmVersionReport",method = RequestMethod.GET)
    public Response oilTcmVersionReport(BaseParam param) {
        List<OilTcmVersionVo> result = vehReportService.oilTcmVersionReport(param);
        return Response.create(result);
    }

    @ApiOperation(value = "油耗-EMS&TCM版本分布 ", notes = "获取油耗-EMS&TCM版本分布统计数据。")
    @RequestMapping(value="oilEmsAndTcmVersionReport",method = RequestMethod.GET)
    public Response oilEmsAndTcmVersionReport(BaseParam param) {
        List<OilEmsTcmVersionVo> result = vehReportService.oilEmsAndTcmVersionReport(param);
        return Response.create(result);
    }

    @ApiOperation(value = "进线量区域排名报表 ", notes = "获取进线量区域排名报表统计数据。")
    @RequestMapping(value="callinAreaReport",method = RequestMethod.GET)
    public Response callinAreaReport(@ApiParam(name = "cycleType", value = "cycleType", required = true) @NotNull CycleType cycleType) {
        List<CallinAreaVo> result = vehReportService.callinAreaReport(cycleType);
        return Response.create(result);
    }

    @ApiOperation(value = "维保状态统计报表 ", notes = "获取维保状态统计报表统计数据。")
    @RequestMapping(value="maintenanceReport",method = RequestMethod.GET)
    public Response maintenanceReport(BaseParam param) {
        List<MaintenanceVo> result = vehReportService.maintenanceReport(param);
        return Response.create(result);
    }
}
